OffchainLabs / nitro-testnode

A complete environment for nitro-based service including sequencer, batch-poster, validator, and a coordinator.
Apache License 2.0
23 stars 57 forks source link

Timeboost mode for nitro-testnode #95

Open Tristan-Wilson opened 1 week ago

Tristan-Wilson commented 1 week ago

This PR adds support for timeboost mode on nitro-testnode. It starts the bid-validator, autonomous auctioneer, deploys the ExpressLaneAuction contract, and starts the sequencer in Timeboost mode.

Since Timeboost is not yet merged into the main nitro or contracts branches, currently you will need to follow the following steps to run nitro-testnode in Timeboost mode. (This will improve once things are merged in.)

When starting up, look for the line printing the token and contract address:

== Bidding token: $biddingTokenAddress, auction contract $auctionContractAddress

You can also find the auction contract and auctioneer address with the following command.

$ docker compose run --entrypoint sh sequencer -c "cat /config/sequencer_config.json" | jq .execution.sequencer
 ✔ Container nitro-testnode-geth-1  Running0.0s 
{
  "enable": true,
  "timeboost": {
    "enable": true,
    "auction-contract-address": "0x7DD3F2a3fAeF3B9F2364c335163244D3388Feb83",
    "auctioneer-address": "0x46225F4cee2b4A1d506C7f894bb3dAeB21BF1596"
  }
}

Users alice and bob have been pre-funded with some of the bidding token on L2 and can be used right away.

$ docker compose run scripts print-private-key --account user_alice
...
$ docker compose run scripts print-private-key --account user_bob
...

# make a deposit into the ExpressLaneAuction contract
$ docker compose run  --entrypoint /usr/local/bin/bidder-client timeboost-bid-validator --auction-contract-address 0x... --deposit-gwei 1000000000  --wallet.private-key <alice or bob private key, no 0x> --arbitrum-node-endpoint http://sequencer:8547

# make a bid for control of the next express lane round
$ docker compose run  --entrypoint /usr/local/bin/bidder-client timeboost-bid-validator --auction-contract-address 0x... --bid-gwei 1 --wallet.private-key <alice or bob private key, no 0x> --arbitrum-node-endpoint http://sequencer:8547 --bid-validator-endpoint http://timeboost-bid-validator:8547 

Commands for sending express lane transactions will be provided in future, see implementation and spec .

Tristan-Wilson commented 1 week ago

Changed the recommended nitro branch to express-lane-timeboost for now since it will get fixes.