Skip to content

Commit

Permalink
Block Gas limit contract integration for Chiado (#7727)
Browse files Browse the repository at this point in the history
Changes summary:
- Continue with the gasLimit check skip in ``verifyHeader`` of
``merge.go`` for unless pre-merge block and blockGasLimitContract
present
- Refactor ``aura.go`` a bit
- Have ``sysCall`` method customized to be able to call state (contract)
at a parent (or any other) header state
  • Loading branch information
somnathb1 authored and AskAlexSharov committed Sep 6, 2023
1 parent 4b89abd commit ff17b6e
Show file tree
Hide file tree
Showing 21 changed files with 798 additions and 573 deletions.
12 changes: 12 additions & 0 deletions DEV_CHAIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ On the terminal you can type the following command to start node1.

```bash
./erigon --datadir=dev --chain=dev --private.api.addr=localhost:9090 --mine
```
Or, you could start the rpcdaemon internally together
```bash
./erigon --datadir=dev --chain=dev --private.api.addr=localhost:9090 --mine --http.api=eth,erigon,web3,net,debug,trace,txpool,parity,admin --http.corsdomain="*"
```

Argument notes:
Expand All @@ -32,6 +36,7 @@ On the terminal you can type the following command to start node1.
* private.api.addr=localhost:9090 : Tells where Eigon is going to listen for connections.
* mine : Add this if you want the node to mine.
* dev.period <number-of-seconds>: Add this to specify the timing interval among blocks. Number of seconds MUST be > 0 (if you want empty blocks) otherwise the default value 0 does not allow mining of empty blocks.
* http.api: List of services to start on http (rpc) access

The result will be something like this:

Expand Down Expand Up @@ -62,11 +67,18 @@ To tell Node 2 where Node 1 is we will use the Enode info of Node 1 we saved bef

Open terminal 3 and navigate to erigon/build/bin folder. Paste in the following command the Enode info and run it, be careful to remove the last part ?discport=0.

The node info of the first peer can also be obtained with an admin RPC call
```bash
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc": "2.0", "method": "admin_nodeInfo", "params": [], "id":83}' localhost:8545
```

```bash
./erigon --datadir=dev2 --chain=dev --private.api.addr=localhost:9091 \
--staticpeers="enode://d30d079163d7b69fcb261c0538c0c3faba4fb4429652970e60fa25deb02a789b4811e98b468726ba0be63b9dc925a019f433177eb6b45c23bb78892f786d8f7a@127.0.0.1:53171" \
--nodiscover
```

You might face a conflict with ports if you run it on the same machine. To specify different ports use, for instance ``--torrent.port 42079``, you might consider specifying all the other flags too: ``--port --http.port --authrpc.port ``

To check if the nodes are connected, you can go to the log of both nodes and look for the line

Expand Down
4 changes: 2 additions & 2 deletions cmd/state/exec3/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ func (rw *Worker) RunTxTaskNoLock(txTask *exec22.TxTask) {
}
// Block initialisation
//fmt.Printf("txNum=%d, blockNum=%d, initialisation of the block\n", txTask.TxNum, txTask.BlockNum)
syscall := func(contract libcommon.Address, data []byte) ([]byte, error) {
return core.SysCallContract(contract, data, rw.chainConfig, ibs, header, rw.engine, false /* constCall */)
syscall := func(contract libcommon.Address, data []byte, ibs *state.IntraBlockState, header *types.Header, constCall bool) ([]byte, error) {
return core.SysCallContract(contract, data, rw.chainConfig, ibs, header, rw.engine, constCall /* constCall */)
}
rw.engine.Initialize(rw.chainConfig, rw.chain, header, ibs, txTask.Txs, txTask.Uncles, syscall)
case txTask.Final:
Expand Down
4 changes: 2 additions & 2 deletions cmd/state/exec3/state_recon.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ func (rw *ReconWorker) runTxTask(txTask *exec22.TxTask) error {
}
} else if txTask.TxIndex == -1 {
// Block initialisation
syscall := func(contract libcommon.Address, data []byte) ([]byte, error) {
return core.SysCallContract(contract, data, rw.chainConfig, ibs, txTask.Header, rw.engine, false /* constCall */)
syscall := func(contract libcommon.Address, data []byte, ibState *state.IntraBlockState, header *types.Header, constCall bool) ([]byte, error) {
return core.SysCallContract(contract, data, rw.chainConfig, ibState, header, rw.engine, constCall /* constCall */)
}

rw.engine.Initialize(rw.chainConfig, rw.chain, txTask.Header, ibs, txTask.Txs, txTask.Uncles, syscall)
Expand Down
Loading

0 comments on commit ff17b6e

Please sign in to comment.