eigerco / nebula

A soroban contract library
https://nebula.eiger.co
Apache License 2.0
7 stars 2 forks source link

Add stake controlled governance contract #51

Closed eloylp closed 1 year ago

eloylp commented 1 year ago

Referenced issue

Closes #36

Summary of changes

Reviewer recommendations

Currenttly this is a WIP, reviewers can check the stream of commits as they go. The author will try to commit small and early.

EDIT - A initial POC was reached. Reviewer is ecouraged to:

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eiger-nebula ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 16, 2023 5:21pm
mariopil commented 1 year ago

I'm having problems with integration tests:

[cargo-make] INFO - Running Task: invoke_init
2023-10-09T08:42:34.279065Z ERROR soroban_cli::log::diagnostic_event: 0: "AAAAAAAAAAAAAAAAAAAAAgAAAAAAAAADAAAADwAAAAdmbl9jYWxsAAAAAA0AAAAgZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAAPAAAABGluaXQAAAAQAAAAAQAAAAUAAAASAAAAAAAAAAAZBisi/w+3Ls+TCbj0Rnum3idac9ln9om6jCwcrqNOLAAAABIAAAABfcHs35M1GZ/JkY2+DHMs4dEUaqjynMnDYK/Gp0eulN8AAAAFAAAAAAAADhAAAAADAAATiAAAAA0AAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO8="
2023-10-09T08:42:34.279511Z ERROR soroban_cli::log::diagnostic_event: 1: "AAAAAAAAAAAAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAACAAAAAAAAAAMAAAAPAAAAB2ZuX2NhbGwAAAAADQAAACBERVWYP/MPT5tnobJ2SVA+DUl1y81j0G+KF7bXd8aSRAAAAA8AAAAEaW5pdAAAABAAAAABAAAABQAAABIAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAAFAAAAAAAADhAAAAADAAATiAAAAAn/////////////////////AAAAAAAAAAE="
2023-10-09T08:42:34.279522Z ERROR soroban_cli::log::diagnostic_event: 2: "AAAAAAAAAAAAAAABREVVmD/zD0+bZ6GydklQPg1JdcvNY9Bvihe213fGkkQAAAACAAAAAAAAAAIAAAAPAAAABWVycm9yAAAAAAAAAgAAAAEAAAAHAAAAEAAAAAEAAAACAAAADgAAAC1WTSBjYWxsIGZhaWxlZDogRnVuYyhNaXNtYXRjaGluZ1BhcmFtZXRlckxlbikAAAAAAAAPAAAABGluaXQ="
2023-10-09T08:42:34.279542Z ERROR soroban_cli::log::diagnostic_event: 3: "AAAAAAAAAAAAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAACAAAAAAAAAAIAAAAPAAAABWVycm9yAAAAAAAAAgAAAAEAAAAHAAAAEAAAAAEAAAADAAAADgAAABRjb250cmFjdCBjYWxsIGZhaWxlZAAAAA8AAAAEaW5pdAAAABAAAAABAAAABQAAABIAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAAFAAAAAAAADhAAAAADAAATiAAAAAn/////////////////////AAAAAAAAAAE="
2023-10-09T08:42:34.279551Z ERROR soroban_cli::log::diagnostic_event: 4: "AAAAAAAAAAAAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAACAAAAAAAAAAIAAAAPAAAABWVycm9yAAAAAAAAAgAAAAEAAAAHAAAADgAAAEBlc2NhbGF0aW5nIGVycm9yIHRvIFZNIHRyYXAgZnJvbSBmYWlsZWQgaG9zdCBmdW5jdGlvbiBjYWxsOiBjYWxs"
2023-10-09T08:42:34.279557Z ERROR soroban_cli::log::diagnostic_event: 5: "AAAAAAAAAAAAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAACAAAAAAAAAAEAAAAPAAAAA2xvZwAAAAAQAAAAAQAAAAMAAAAOAAAAHlZNIGNhbGwgdHJhcHBlZCB3aXRoIEhvc3RFcnJvcgAAAAAADwAAAARpbml0AAAAAgAAAAEAAAAH"
error: transaction simulation failed: host invocation failed

Caused by:
    HostError: Error(WasmVm, InternalError)

    Event log (newest first):
       0: [Diagnostic Event] contract:65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923, topics:[error, Error(WasmVm, InternalError)], data:"escalating error to VM trap from failed host function call: call"
       1: [Diagnostic Event] contract:65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923, topics:[error, Error(WasmVm, InternalError)], data:["contract call failed", init, [Address(Contract(65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923)), 3600, 5000, 340282366920938463463374607431768211455, true]]
       2: [Failed Diagnostic Event (not emitted)] contract:444555983ff30f4f9b67a1b27649503e0d4975cbcd63d06f8a17b6d777c69244, topics:[error, Error(WasmVm, InternalError)], data:["VM call failed: Func(MismatchingParameterLen)", init]
       3: [Diagnostic Event] contract:65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923, topics:[fn_call, Bytes(444555983ff30f4f9b67a1b27649503e0d4975cbcd63d06f8a17b6d777c69244), init], data:[Address(Contract(65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923)), 3600, 5000, 340282366920938463463374607431768211455, true]
       4: [Diagnostic Event] topics:[fn_call, Bytes(65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923), init], data:[Address(Account(19062b22ff0fb72ecf9309b8f4467ba6de275a73d967f689ba8c2c1caea34e2c)), Address(Contract(7dc1ecdf9335199fc9918dbe0c732ce1d1146aa8f29cc9c360afc6a747ae94df)), 3600, 5000, Bytes(00000000000000000000000000000000000000000000000000000000000000ef)]

    Backtrace (newest first):
       0: soroban_wasmi::engine::EngineExecutor::execute_wasm_func
       1: soroban_wasmi::engine::EngineInner::execute_func
       2: soroban_wasmi::func::Func::call
       3: soroban_env_host::vm::Vm::invoke_function_raw
       4: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::with_frame
       5: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::call_n_internal
       6: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::invoke_function
       7: preflight::preflight::preflight_invoke_hf_op
       8: preflight::preflight_invoke_hf_op::{{closure}}
       9: core::ops::function::FnOnce::call_once{{vtable.shim}}
      10: preflight::catch_preflight_panic
      11: _cgo_0b49d6ed4a0b_Cfunc_preflight_invoke_hf_op
                 at tmp/go-build/cgo-gcc-prolog:103:11
      12: runtime.asmcgocall
                 at ./runtime/asm_amd64.s:848

[cargo-make] ERROR - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.
eloylp commented 1 year ago

I'm having problems with integration tests:

[cargo-make] INFO - Running Task: invoke_init
2023-10-09T08:42:34.279065Z ERROR soroban_cli::log::diagnostic_event: 0: "AAAAAAAAAAAAAAAAAAAAAgAAAAAAAAADAAAADwAAAAdmbl9jYWxsAAAAAA0AAAAgZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAAPAAAABGluaXQAAAAQAAAAAQAAAAUAAAASAAAAAAAAAAAZBisi/w+3Ls+TCbj0Rnum3idac9ln9om6jCwcrqNOLAAAABIAAAABfcHs35M1GZ/JkY2+DHMs4dEUaqjynMnDYK/Gp0eulN8AAAAFAAAAAAAADhAAAAADAAATiAAAAA0AAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO8="
2023-10-09T08:42:34.279511Z ERROR soroban_cli::log::diagnostic_event: 1: "AAAAAAAAAAAAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAACAAAAAAAAAAMAAAAPAAAAB2ZuX2NhbGwAAAAADQAAACBERVWYP/MPT5tnobJ2SVA+DUl1y81j0G+KF7bXd8aSRAAAAA8AAAAEaW5pdAAAABAAAAABAAAABQAAABIAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAAFAAAAAAAADhAAAAADAAATiAAAAAn/////////////////////AAAAAAAAAAE="
2023-10-09T08:42:34.279522Z ERROR soroban_cli::log::diagnostic_event: 2: "AAAAAAAAAAAAAAABREVVmD/zD0+bZ6GydklQPg1JdcvNY9Bvihe213fGkkQAAAACAAAAAAAAAAIAAAAPAAAABWVycm9yAAAAAAAAAgAAAAEAAAAHAAAAEAAAAAEAAAACAAAADgAAAC1WTSBjYWxsIGZhaWxlZDogRnVuYyhNaXNtYXRjaGluZ1BhcmFtZXRlckxlbikAAAAAAAAPAAAABGluaXQ="
2023-10-09T08:42:34.279542Z ERROR soroban_cli::log::diagnostic_event: 3: "AAAAAAAAAAAAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAACAAAAAAAAAAIAAAAPAAAABWVycm9yAAAAAAAAAgAAAAEAAAAHAAAAEAAAAAEAAAADAAAADgAAABRjb250cmFjdCBjYWxsIGZhaWxlZAAAAA8AAAAEaW5pdAAAABAAAAABAAAABQAAABIAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAAFAAAAAAAADhAAAAADAAATiAAAAAn/////////////////////AAAAAAAAAAE="
2023-10-09T08:42:34.279551Z ERROR soroban_cli::log::diagnostic_event: 4: "AAAAAAAAAAAAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAACAAAAAAAAAAIAAAAPAAAABWVycm9yAAAAAAAAAgAAAAEAAAAHAAAADgAAAEBlc2NhbGF0aW5nIGVycm9yIHRvIFZNIHRyYXAgZnJvbSBmYWlsZWQgaG9zdCBmdW5jdGlvbiBjYWxsOiBjYWxs"
2023-10-09T08:42:34.279557Z ERROR soroban_cli::log::diagnostic_event: 5: "AAAAAAAAAAAAAAABZVOfSltKPhdkgbreSXQ4FZrQ3UMK4sFIlI5jxdm9aSMAAAACAAAAAAAAAAEAAAAPAAAAA2xvZwAAAAAQAAAAAQAAAAMAAAAOAAAAHlZNIGNhbGwgdHJhcHBlZCB3aXRoIEhvc3RFcnJvcgAAAAAADwAAAARpbml0AAAAAgAAAAEAAAAH"
error: transaction simulation failed: host invocation failed

Caused by:
    HostError: Error(WasmVm, InternalError)

    Event log (newest first):
       0: [Diagnostic Event] contract:65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923, topics:[error, Error(WasmVm, InternalError)], data:"escalating error to VM trap from failed host function call: call"
       1: [Diagnostic Event] contract:65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923, topics:[error, Error(WasmVm, InternalError)], data:["contract call failed", init, [Address(Contract(65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923)), 3600, 5000, 340282366920938463463374607431768211455, true]]
       2: [Failed Diagnostic Event (not emitted)] contract:444555983ff30f4f9b67a1b27649503e0d4975cbcd63d06f8a17b6d777c69244, topics:[error, Error(WasmVm, InternalError)], data:["VM call failed: Func(MismatchingParameterLen)", init]
       3: [Diagnostic Event] contract:65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923, topics:[fn_call, Bytes(444555983ff30f4f9b67a1b27649503e0d4975cbcd63d06f8a17b6d777c69244), init], data:[Address(Contract(65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923)), 3600, 5000, 340282366920938463463374607431768211455, true]
       4: [Diagnostic Event] topics:[fn_call, Bytes(65539f4a5b4a3e176481bade497438159ad0dd430ae2c148948e63c5d9bd6923), init], data:[Address(Account(19062b22ff0fb72ecf9309b8f4467ba6de275a73d967f689ba8c2c1caea34e2c)), Address(Contract(7dc1ecdf9335199fc9918dbe0c732ce1d1146aa8f29cc9c360afc6a747ae94df)), 3600, 5000, Bytes(00000000000000000000000000000000000000000000000000000000000000ef)]

    Backtrace (newest first):
       0: soroban_wasmi::engine::EngineExecutor::execute_wasm_func
       1: soroban_wasmi::engine::EngineInner::execute_func
       2: soroban_wasmi::func::Func::call
       3: soroban_env_host::vm::Vm::invoke_function_raw
       4: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::with_frame
       5: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::call_n_internal
       6: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::invoke_function
       7: preflight::preflight::preflight_invoke_hf_op
       8: preflight::preflight_invoke_hf_op::{{closure}}
       9: core::ops::function::FnOnce::call_once{{vtable.shim}}
      10: preflight::catch_preflight_panic
      11: _cgo_0b49d6ed4a0b_Cfunc_preflight_invoke_hf_op
                 at tmp/go-build/cgo-gcc-prolog:103:11
      12: runtime.asmcgocall
                 at ./runtime/asm_amd64.s:848

[cargo-make] ERROR - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.

Hello @mariopil , in tried to replicate this error by executing:

$ cargo make run_test

At least three times, but without problems. Could it be a futurenet transient problem ? I am at commit 8f1b8eb841f4cc35eb59da47cba56117db1b6ba3

Maybe its a matter of having the voting contract outdated (the resulting wasm file) . Could you try again with:

$ cargo clean
$ soroban contract build --package voting
$ soroban contract build --package governance
$ cargo make run_test

Sometimes happened to me i did not update the voting contract compilation, on which depends the governance one.

mariopil commented 1 year ago

Hmm, after cleaning everything and rebuilding it works now...