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

Backward compatibility - Native function implementations #3519

Open
Kouteki opened this issue Jan 15, 2025 · 0 comments
Open

Backward compatibility - Native function implementations #3519

Kouteki opened this issue Jan 15, 2025 · 0 comments
Labels
🐞 bug Something isn't working in focus Core team is prioritizing this work 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@Kouteki
Copy link
Contributor

Kouteki commented Jan 15, 2025

Description

Originally referenced in #1896

Context

It's important to be aware that all native functions could have backward compatibility issues when we update their native implementation. This is not introduced by the new binding solution; instead, it makes the potential issue more apparent.

During contract execution, the functionValue.nativeBody,

fv.nativeBody = m.Store.GetNative(fv.NativePkg, fv.NativeName)

which is a func(*Machine) returned from iterating through nativeFuncs in stdlibs/native.go, by finding matching package and names,
var nativeFuncs = [...]nativeFunc{

returns a matching func(*Machine) when the VM executes the contract.

For example, in the standard contract stdlib/std/native.gno, PrevRealm() > getRealm(1), the nativeFuncs links Gno's getRealm(1)

func getRealm(height int) (address string, pkgPath string)

with the native implementation of X_getRealm().
func X_getRealm(m *gno.Machine, height int) (address string, pkgPath string) {

r0, r1 := libs_std.X_getRealm(

Backward compatibility issues:

updating the logic in stdlibs/std/native.go could cause existing contracts to fail to execute if contract developers assume the behaviors of PrevRealm have changed in a new release.

@Kouteki Kouteki added 🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related labels Jan 15, 2025
@Kouteki Kouteki moved this from Triage to Todo in 🧙‍♂️gno.land core team Jan 15, 2025
@Kouteki Kouteki added this to the 🚀 Mainnet beta launch milestone Jan 15, 2025
@Kouteki Kouteki added the in focus Core team is prioritizing this work label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working in focus Core team is prioritizing this work 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Development

No branches or pull requests

1 participant