-
Notifications
You must be signed in to change notification settings - Fork 451
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
On-demand module compile #2739
base: master
Are you sure you want to change the base?
On-demand module compile #2739
Conversation
I'm afraid I cannot realistically review this with everything going on with BoLD. Sorry. Removing myself as a reviewer for now. |
arbos/programs/native.go
Outdated
// we know program is activated, so it must be in correct version and not use too much memory | ||
info, asmMap, err := activateProgramInternal(statedb, addressForLogging, codeHash, wasm, pagelimit, program.version, zeroArbosVersion, debugMode, &zeroGas) | ||
moduleActivationMandatory := false |
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.
we might need to set moduleActivationMandatory
here to true and activate the module each time we need to recompile to get the activationInfo
(here info
) to check info.moduleHash
against moduleHash
.
alternatively, we can skip the check if info is nil, so we'd have:
if info != nil && info.moduleHash != moduleHash {
log.Error("failed to reactivate program", "address", addressForLogging, "expected moduleHash", moduleHash, "got", info.moduleHash)
return nil, fmt.Errorf("failed to reactivate program. address: %v, expected ModuleHash: %v", addressForLogging, moduleHash)
}
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.
there is also a question how it should work in context of the later code:
currentHoursSince := hoursSinceArbitrum(time)
if currentHoursSince > program.activatedAt {
// stylus program is active on-chain, and was activated in the past
// so we store it directly to database
batch := statedb.Database().WasmStore().NewBatch()
rawdb.WriteActivation(batch, moduleHash, asmMap)
if err := batch.Write(); err != nil {
log.Error("failed writing re-activation to state", "address", addressForLogging, "err", err)
}
} else {
// program activated recently, possibly in this eth_call
// store it to statedb. It will be stored to database if statedb is commited
statedb.ActivateWasm(info.moduleHash, asmMap)
}
can we just use moduleHash
instead of info.moduleHash
here?
Resolves NIT-2633