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

Execution Node Versioning Contract for Rolling Upgrades #310

Merged
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
358d211
Created framework for exec node versioning contract
sisyphusSmiling Sep 1, 2022
bdab0dd
Created ENVersionBeacon interface
sisyphusSmiling Sep 2, 2022
f065aa6
Updated ExecutionNodeVersionBeacon based on feedback on Interface
sisyphusSmiling Sep 7, 2022
5f2a1c6
Completed implementation of ExecutionNodeVersionBeacon against planne…
sisyphusSmiling Sep 8, 2022
d347200
Created txns & scripts for ExecutionNodeVersionBeacon contract
sisyphusSmiling Sep 9, 2022
4a8276c
Initialized js test suite
sisyphusSmiling Sep 9, 2022
d31247c
Assigning older ver flow-js-testing to troubleshoot dependency issue
sisyphusSmiling Sep 14, 2022
8f5feb5
JS tests working. Added script templates & getter for versionBufferVa…
sisyphusSmiling Sep 14, 2022
bcaab0d
Created js helper transaction_templates. Updated events & buffer vari…
sisyphusSmiling Sep 14, 2022
55ba85a
Updated ENVerBeacon contract w/ new data structs to maintain proximal…
sisyphusSmiling Sep 15, 2022
da5d352
Updated .github/workflow/ci.yml for js test suite
sisyphusSmiling Sep 15, 2022
a091848
Added comments to ENVersionBeacon scripts
sisyphusSmiling Sep 15, 2022
ed7297e
Added JS test cases for ExecutionNodeVersionBeacon contract
sisyphusSmiling Sep 16, 2022
04981cc
Test coverage for ExecutionNodeVersionBeacon.changeVersionUpdateBuffer()
sisyphusSmiling Sep 16, 2022
444d2e9
Completed ExecutionNodeVersionBeacon contract tests, transactions & s…
sisyphusSmiling Sep 17, 2022
899e1c7
minor improvements
satyamakgec Sep 20, 2022
31cdf05
update go assets
satyamakgec Sep 20, 2022
e0e01dc
remove versionUpdateBufferVariance
satyamakgec Sep 21, 2022
e7c3e1d
fix go tests
satyamakgec Sep 21, 2022
dea65cf
Fix minor spelling typos
alilloig Sep 23, 2022
27418be
update go assets
sisyphusSmiling Sep 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ jobs:
- uses: actions/setup-go@v1
with:
go-version: '1.18'
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
cache-dependency-path: lib/js/test/package-lock.json
- name: Install Flow CLI
run: sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)"
- name: Flow cli Version
run: flow version
- name: Update PATH
run: echo "/root/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: cd lib/js/test && npm ci
- name: Run tests
run: export GOPATH=$HOME/go && make ci

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

.DS_Store

flow.json
node_modules

# IDE related files
.idea
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
test:
$(MAKE) generate -C lib/go
$(MAKE) test -C lib/go
$(MAKE) test -C lib/js/test

.PHONY: ci
ci:
$(MAKE) ci -C lib/go
$(MAKE) ci -C lib/js/test
425 changes: 425 additions & 0 deletions contracts/ExecutionNodeVersionBeacon.cdc

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions flow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"networks": {
"emulator": "127.0.0.1:3569",
"mainnet": "access.mainnet.nodes.onflow.org:9000",
"testnet": "access.devnet.nodes.onflow.org:9000"
},
"contracts": {
"FlowClusterQC": "./contracts/epochs/FlowClusterQC.cdc",
"FlowEpoch": "./contracts/epochs/FlowEpoch.cdc",
"FlowDKG": "./contracts/epochs/FlowEpoch.cdc",
"ExecutionNodeVersionBeacon": "./contracts/ExecutionNodeVersionBeacon.cdc",
"FlowContractAudits": "./contracts/FlowContractAudits.cdc",
"FlowFees": "./contracts/FlowFees.cdc",
"FlowIDTableStaking": "./contracts/FlowIDTableStaking.cdc",
"FlowIDTableStaking_old": "./contracts/FlowIDTableStaking_old.cdc",
"FlowServiceAccount": "./contracts/FlowServiceAccount.cdc",
"FlowStakingCollection": "./contracts/FlowStakingCollection.cdc",
"FlowStorageFees": "./contracts/FlowStorageFees.cdc",
"FlowToken": "./contracts/FlowToken.cdc",
"LockedTokens": "./contracts/LockedTokens.cdc",
"StakingProxy": "./contracts/StakingProxy.cdc"
},
"accounts": {
"emulator-account": {
"address": "f8d6e0586b0a20c7",
"key": "c33f601b3d88ca23bcdd77637eca81f905e3354d4229dce3cb1fd4920e7cbe66"
}
}
}
52 changes: 26 additions & 26 deletions lib/go/contracts/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,38 @@ import (
///

const (
flowFeesFilename = "FlowFees.cdc"
storageFeesFilename = "FlowStorageFees.cdc"
flowServiceAccountFilename = "FlowServiceAccount.cdc"
flowTokenFilename = "FlowToken.cdc"
flowIdentityTableFilename = "FlowIDTableStaking.cdc"
flowQCFilename = "epochs/FlowClusterQC.cdc"
flowDKGFilename = "epochs/FlowDKG.cdc"
flowEpochFilename = "epochs/FlowEpoch.cdc"
flowLockedTokensFilename = "LockedTokens.cdc"
flowStakingProxyFilename = "StakingProxy.cdc"
flowStakingCollectionFilename = "FlowStakingCollection.cdc"
flowContractAuditsFilename = "FlowContractAudits.cdc"
flowFeesFilename = "FlowFees.cdc"
storageFeesFilename = "FlowStorageFees.cdc"
flowServiceAccountFilename = "FlowServiceAccount.cdc"
flowTokenFilename = "FlowToken.cdc"
flowIdentityTableFilename = "FlowIDTableStaking.cdc"
flowQCFilename = "epochs/FlowClusterQC.cdc"
flowDKGFilename = "epochs/FlowDKG.cdc"
flowEpochFilename = "epochs/FlowEpoch.cdc"
flowLockedTokensFilename = "LockedTokens.cdc"
flowStakingProxyFilename = "StakingProxy.cdc"
flowStakingCollectionFilename = "FlowStakingCollection.cdc"
flowContractAuditsFilename = "FlowContractAudits.cdc"
executionNodeVersionBeaconFilename = "ExecutionNodeVersionBeacon.cdc"

// Test contracts
// only used for testing
TESTFlowIdentityTableFilename = "testContracts/TestFlowIDTableStaking.cdc"

// Each contract has placeholder addresses that need to be replaced
// depending on which network they are being used with
placeholderFungibleTokenAddress = "0xFUNGIBLETOKENADDRESS"
placeholderFlowTokenAddress = "0xFLOWTOKENADDRESS"
placeholderIDTableAddress = "0xFLOWIDTABLESTAKINGADDRESS"
placeholderStakingProxyAddress = "0xSTAKINGPROXYADDRESS"
placeholderQCAddr = "0xQCADDRESS"
placeholderDKGAddr = "0xDKGADDRESS"
placeholderEpochAddr = "0xEPOCHADDRESS"
placeholderFlowFeesAddress = "0xFLOWFEESADDRESS"
placeholderStorageFeesAddress = "0xFLOWSTORAGEFEESADDRESS"
placeholderLockedTokensAddress = "0xLOCKEDTOKENSADDRESS"
placeholderStakingCollectionAddress = "0xFLOWSTAKINGCOLLECTIONADDRESS"
placeholderFungibleTokenAddress = "0xFUNGIBLETOKENADDRESS"
placeholderFlowTokenAddress = "0xFLOWTOKENADDRESS"
placeholderIDTableAddress = "0xFLOWIDTABLESTAKINGADDRESS"
placeholderStakingProxyAddress = "0xSTAKINGPROXYADDRESS"
placeholderQCAddr = "0xQCADDRESS"
placeholderDKGAddr = "0xDKGADDRESS"
placeholderEpochAddr = "0xEPOCHADDRESS"
placeholderFlowFeesAddress = "0xFLOWFEESADDRESS"
placeholderStorageFeesAddress = "0xFLOWSTORAGEFEESADDRESS"
placeholderLockedTokensAddress = "0xLOCKEDTOKENSADDRESS"
placeholderStakingCollectionAddress = "0xFLOWSTAKINGCOLLECTIONADDRESS"
placeholderExecutionNodeVersionBeaconAddress = "0xEXECUTIONNODEVERSIONBEACONADDRESS"
)

// Adds a `0x` prefix to the provided address string
Expand Down Expand Up @@ -116,7 +118,6 @@ func FlowFees(fungibleTokenAddress, flowTokenAddress string) []byte {

// FlowStorageFees returns the FlowStorageFees contract
// which imports the fungible token and flow token contracts
//
func FlowStorageFees(fungibleTokenAddress, flowTokenAddress string) []byte {
code := assets.MustAssetString(storageFeesFilename)

Expand Down Expand Up @@ -171,7 +172,7 @@ func FlowServiceAccount(fungibleTokenAddress, flowTokenAddress, flowFeesAddress,

// FlowIDTableStaking returns the FlowIDTableStaking contract
//
// The staking contract imports the FungibleToken and FlowToken contracts
// # The staking contract imports the FungibleToken and FlowToken contracts
//
// Parameter: latest: indicates if the contract is the latest version, or an old version. Used to test upgrades
func FlowIDTableStaking(fungibleTokenAddress, flowTokenAddress, flowFeesAddress string, latest bool) []byte {
Expand Down Expand Up @@ -226,7 +227,6 @@ func FlowStakingCollection(
// FlowLockedTokens return the LockedTokens contract
//
// Locked Tokens imports FungibleToken, FlowToken, FlowIDTableStaking, StakingProxy, and FlowStorageFees
//
func FlowLockedTokens(
fungibleTokenAddress,
flowTokenAddress,
Expand Down
23 changes: 23 additions & 0 deletions lib/go/contracts/internal/assets/assets.go

Large diffs are not rendered by default.

Loading