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

Bootstrap with EVM by default #5482

Merged

Conversation

janezpodhostnik
Copy link
Contributor

@janezpodhostnik janezpodhostnik commented Feb 29, 2024

closes: #5491 and #5382

Should be ported back to master as well

@janezpodhostnik janezpodhostnik self-assigned this Feb 29, 2024
@janezpodhostnik janezpodhostnik force-pushed the janez/bootstrap-with-evm-as-default branch from 3bbd0cc to e949a4e Compare March 1, 2024 16:02
b.registerNodes(service, fungibleToken, flowToken)

// set the list of nodes which are allowed to stake in this network
b.setStakingAllowlist(service, b.identities.NodeIDs())

// sets up the EVM environment
b.setupEVM(service, fungibleToken, flowToken)
Copy link
Member

Choose a reason for hiding this comment

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

Ah, so this is why the indices were off last time. We set up the EVM after creating the node accounts 💡

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! I did not see that registerNodes creates new accounts.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe leave a warning in the code to make it more obvious that registerNodes creates accounts (maybe even improve naming) and maybe that contracts should be deployed before it.

Comment on lines 65 to 69
FlowTokenAccountIndex = 3
FlowFeesAccountIndex = 4
EVMStorageAccountIndex = 5

LastSystemAccountIndex = EVMStorageAccountIndex
Copy link
Member

Choose a reason for hiding this comment

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

I suggest adding additional documentation here.

These are the account indexes of system contracts as deployed by the default bootstrapping.

However, this package also contains information about chains which were not deployed by the default bootstrapping, like Mainnet and Testnet. For those chains, I don't think these indices will point to the right contracts.

@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 37.20930% with 27 lines in your changes are missing coverage. Please review.

Project coverage is 55.98%. Comparing base (ecb8b87) to head (b32afa6).

Files Patch % Lines
fvm/bootstrap.go 37.50% 18 Missing and 7 partials ⚠️
utils/unittest/execution_state.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                     @@
##           feature/stable-cadence    #5482      +/-   ##
==========================================================
- Coverage                   56.01%   55.98%   -0.04%     
==========================================================
  Files                        1042     1042              
  Lines                      101950   101982      +32     
==========================================================
- Hits                        57112    57096      -16     
- Misses                      40491    40533      +42     
- Partials                     4347     4353       +6     
Flag Coverage Δ
unittests 55.98% <37.20%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -62,7 +64,7 @@ func TestWriteMachineAccountFiles(t *testing.T) {
expected := make(map[string]bootstrap.NodeMachineAccountInfo)
for i, node := range nodes {
// See comments in WriteMachineAccountFiles for why addresses take this form
addr, err := chain.AddressAtIndex(uint64(6 + i*2))
addr, err := chain.AddressAtIndex(uint64(systemcontracts.LastSystemAccountIndex + (i+1)*2))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jordanschalm can you confirm this logic is correct?

Copy link
Member

Choose a reason for hiding this comment

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

It looks correct to me 👍

@janezpodhostnik janezpodhostnik marked this pull request as ready for review March 1, 2024 18:05
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

👍

@janezpodhostnik janezpodhostnik merged commit 524be1e into feature/stable-cadence Mar 1, 2024
50 of 51 checks passed
@janezpodhostnik janezpodhostnik deleted the janez/bootstrap-with-evm-as-default branch March 1, 2024 19:11
@turbolent
Copy link
Member

@janezpodhostnik The merge of this PR broke the tests on the target branch, see https://github.com/onflow/flow-go/actions/runs/8116077900/job/22185298828. Can you please have a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants