-
Notifications
You must be signed in to change notification settings - Fork 205
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
Checking minimum client version #481
Conversation
const defaultGasAmount = 2000000 | ||
|
||
var ( | ||
blockchainParametersABI, _ = abi.JSON(strings.NewReader(blockchainParametersABIString)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we use init()
and check the error here? (golang newbie here)
@kevjue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrsmkl can we move this to an init and check the error?
About killing the node, perhaps we should check for a confirmed block? |
What do you mean by checking for a confirmed block? Do you mean waiting for an additional block? |
Yeah, I was thinking that it would read the value from some parent block. |
} | ||
|
||
if params.CurrentVersionInfo.Cmp(version) == -1 { | ||
time.Sleep(10 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why sleep here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When testing, it's useful to know that the node cannot exit immediately when making the transaction.
params/protocol_params.go
Outdated
@@ -156,3 +157,5 @@ const ( | |||
// We charge for reading the balance, 1 debit, and 3 credits (refunding gas, paying the gas fee recipient, sending to the infrastructure fund) | |||
AdditionalGasForNonGoldCurrencies uint64 = 3*ExpectedGasForCreditToTransactions + ExpectedGasForDebitFromTransactions + ExpectedGasToReadErc20Balance | |||
) | |||
|
|||
const ContractCommGas uint64 = 2000000 // gas amount used for querying system contracts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is entirely accurate, as if you look above we specify different amounts for different calls to system contracts. Instead, consider specifying one specific to this call, e.g. MaxGasForGetMinimumClientVersion
@@ -97,7 +97,7 @@ const ( | |||
]` | |||
) | |||
|
|||
const defaultGasAmount = 2000000 | |||
const defaultGasAmount = params.ContractCommGas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
contract_comm/random/random.go
Outdated
@@ -84,7 +84,7 @@ const ( | |||
"type": "function" | |||
} | |||
]` | |||
gasAmount = 1000000 | |||
gasAmount = params.ContractCommGas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
var err error | ||
blockchainParametersABI, err = abi.JSON(strings.NewReader(blockchainParametersABIString)) | ||
if err != nil { | ||
log.Error("Error reading ABI for BlockchainParameters", "err", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably fatal here, since this happens on startup and the erros means a developer bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a comment, but the rest is ok
Description
Checks the minimum client version from a smart contract, exits with error message if required version is larger than current version.
Tested
Still need to figure out how to test.
Other changes
Related issues
PR for the smart contract: celo-org/celo-monorepo#1081
Backwards compatibility