Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --l2-anytrust option to run in AnyTrust mode #79

Merged
merged 5 commits into from
Oct 4, 2024

Conversation

Tristan-Wilson
Copy link
Member

test-node.bash can now be run with --l2-anytrust which runs the l2 nodes in AnyTrust mode. It creates a committee of 2 daserver with assumed-honest set to 1, requiring successful stores of the batch data to both of them. Nitro nodes sync from a mirror daserver. All dasevers use local file storage for the batch data on their own volumes.

BLS keys for the committee are automatically generated and the keyset is activated automatically on the SequencerInbox contract.

Testing done

Tested that --no-run generates config correctly:

./test-node.bash --init-force --dev --l2-anytrust --no-build --no-run
...
# inspecting various config files
 docker compose run --entrypoint sh scripts -c "cat /config/l2_das_keyset.json"  |jq .

Tested running

./test-node.bash --init-force --dev --l2-anytrust --no-build

...
# keyset is set
{                                                                                                                                                                                                     
  type: 2,                                                                                                                                                                                            
  chainId: 1337,                                                                                                                                                                                      
  nonce: 27,                                                                                                                                                                                          
  maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },                                                                                                                         
  maxFeePerGas: BigNumber { _hex: '0x59683026', _isBigNumber: true },                                                                                                                                 
  gasPrice: null,                                                                                                                                                                                     
  gasLimit: BigNumber { _hex: '0x020d2e', _isBigNumber: true },                                                                                                                                       
  to: '0x513D9F96d4D0563DEbae8a0DC307ea0E46b10ed7',                                                                                                                                                   
  value: BigNumber { _hex: '0x00', _isBigNumber: true },                                                                                                                                              
  data: '0xbca8c7b500000000000000000000000018d19c5d3e685f5be5b9c86e097f0e439285d2160000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000
00000000002a4d1ce8da800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000256000000000000000100000000000000020121600e2afd75d94
45e25d89c11d2bc2b3e5238030df8c173e40365a8f0f0f1c133d82488d31b073f692fd6e57085d315f5f0031b49e83a69a00ca8d9660cb752322848042ba7496be7a62909dea1a44a9f7f0525444651f42f824c6ee0283a91c8d51435843fdbd1010b0
8d8d93da421c93129f849bbc2a0922faa25771892801a7de61e7b6d79863b45ba2b1e4c26cc2a03142864d8e1ad15630ac086eee52c76d532a7c154560b07206131e56ee62c6a0bba34ecb2af058b85ab54fd39ae3500870d22b2a6e8c16eaba02c258
54335a842db48674a35a34ad7c0201e18c5a82baa2c1675d40daa508d04d8f41860aa8e280f879a03dec5292fd0602e3bd22d80b1aca3d55c76c16f0ddc0e2af11f1a208e91d1c8d768fefb46076f1f2444307b5e01216010e0d4a5f89ea133f412905
44ae4c7a9c2de2f9a18862ce81ea631673129a5a3effe1223d8b89a5228f30716cf2d14dd05cb725034ea4ce871521720493f5182c6e6fe6546f1ab5cc18efd15ad5c2596dfc2d24116980b081ac8313b4061e18d0d6d0df4c545bb8c57786f048cca1
f817ca0b35c1c23fd017361d8748c3ea08fae77e77d3c566e7934687a4e216dd6bd01e2bac8c0a3bba51155998d9bccbdc189d2f39c84f8b61422cfdd6bd49d750eb111ad47b69f68924c777e2082e822e517ce962b4f0edd60c065d4d4fec3bc3a9d3
525b99085132dc2090b74322a696e4adb4cff34e722d6a378b0b726935581148d0be648707341647d10c2b003ae9fa4f091286135c3f36b1ee619f7412abd70879a6eea733c896fefe5894ff0d9b700000000000000000000000000000000000000000
00000000000000000000000000000000000',                                                                                                                                                                 
  accessList: [],                                                                                                                                                                                     
  hash: '0xfaf59ee50c29e9212d5f2a6d39a027d5f2bdaa60ccb41aa2b6a8baf314b4124f',                                                                                                                         
  v: 1,                                                                                            
  r: '0xef5ad4feaae965b80ee0c3612c291b776e400c0028befac8f0a5e721983ec9b2',                                                                                                                            
  s: '0x7759530029617e1ade9875e8deb5a1283d9e266056cafd3325711093f6fbc527',                                                                                                                            
  from: '0x5E1497dD1f08C87b2d8FE23e9AAB6c1De833D927',                                                                                                                                                 
  confirmations: 0,                              
  wait: [Function (anonymous)]                                                                                                                                                                        
}                                        
...
== Starting AnyTrust committee and mirror                                                                                                                                   
[+] Running 3/3                                  
 ✔ Container nitro-testnode-das-committee-a-1  He...                                              0.8s                                                                                                
 ✔ Container nitro-testnode-das-committee-b-1  He...                                              0.8s                                                                                                
 ✔ Container nitro-testnode-das-mirror-1       Healthy                                            0.8s      
...

Check the das mirror has some data, meaning the batch poster successfully posted the data and it was synced by the mirror from the committee.

$ docker compose run --entrypoint sh das-mirror -c "ls -lR /das/data/"
WARN[0000] Found orphan containers ([nitro-testnode-scripts-run-a35e3922ff7e nitro-testnode-das-mirror-run-fee25f4f176d]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
/das/data/:
total 0
drwx------. 1 user user  4 Sep  4 17:00 by-data-hash
drwx------. 1 user user 12 Sep  4 17:00 by-expiry-timestamp

/das/data/by-data-hash:
total 0
drwx------. 1 user user 4 Sep  4 17:00 5b

/das/data/by-data-hash/5b:
total 0
drwx------. 1 user user 128 Sep  4 17:00 85

/das/data/by-data-hash/5b/85:
total 4
-rw-------. 2 user user 3831 Sep  4 17:00 5b859f91e827b270666856439a18ee9f3df31f2240d5a599adba707438577ba1

/das/data/by-expiry-timestamp:
total 0
drwx------. 1 user user 8 Sep  4 17:00 172676

/das/data/by-expiry-timestamp/172676:
total 0
drwx------. 1 user user 128 Sep  4 17:00 5254

/das/data/by-expiry-timestamp/172676/5254:
total 4
-rw-------. 2 user user 3831 Sep  4 17:00 5b859f91e827b270666856439a18ee9f3df31f2240d5a599adba707438577ba1

test-node.bash can now be run with --l2-anytrust which runs the l2
nodes in AnyTrust mode. It creates a committee of 2 daserver with
assumed-honest set to 1, requiring successful stores of the batch data
to both of them. Nitro nodes sync from a mirror daserver. All dasevers
use local file storage for the batch data on their own volumes.

BLS keys for the committee are automatically generated and the keyset is
activated automatically on the SequencerInbox contract.
@Tristan-Wilson
Copy link
Member Author

Fixes NIT-2637

Adjacent line changes on arbitrum DataAvailabilityCommittee and
InitialArbOSVersion, no actual conflict.
@cla-bot cla-bot bot added the s label Sep 30, 2024
scripts/config.ts Outdated Show resolved Hide resolved
scripts/config.ts Outdated Show resolved Hide resolved
scripts/config.ts Outdated Show resolved Hide resolved
scripts/config.ts Outdated Show resolved Hide resolved
test-node.bash Outdated Show resolved Hide resolved
test-node.bash Outdated
echo == Starting AnyTrust committee and mirror
docker compose up --wait das-committee-a das-committee-b das-mirror
# TODO how to make these containers go down since they are now
# run in the background
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need to bring them up here?
I would assume that adding these nodes to both NODES and INITIAL_SEQ_NODES would work.

It's o.k to have nodes running in the background. That's how geth is running. all nodes can be taken up/down with docker-compose.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the DA committee needs to be up before we start the sequencer and there isn't a way to model that dependency in the docker-compose.yaml conditionally, so I was starting it separately.

Removed the TODO note.

test-node.bash Outdated Show resolved Hide resolved
test-node.bash Outdated Show resolved Hide resolved
argv.to = "address_" + upgradeExecutorAddr
argv.ethamount = "0"

await runStress(argv, sendTransaction);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runStress isn't really needed here since you should only run one transaction in one thread

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I just used it because it's what's used throughout this file. I'll try changing it to something else.

scripts/config.ts Show resolved Hide resolved
Copy link
Collaborator

@tsahee tsahee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Tristan-Wilson Tristan-Wilson merged commit fa19e22 into master Oct 4, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants