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

passing e2e tests #855

Merged
merged 41 commits into from
Sep 4, 2023
Merged

passing e2e tests #855

merged 41 commits into from
Sep 4, 2023

Conversation

sreuland
Copy link
Contributor

@sreuland sreuland commented Aug 11, 2023

What

bump versions used by e2e

Why

sync up component refs to all have same xdr versions

Known limitations

need to get.new release version of js-soroban-client with the same xdr bump, currently using a gh ref to the pending branch

@sreuland
Copy link
Contributor Author

will need to get the hello_world and increment contracts on soroban-examples updated to use the latest soroban-sdk with latest env-host versions, when running the tests using contracts from soroban-examples/main, getting preflight errors on the contract interface version

[Diagnostic Event] topics:[error, Error(WasmVm, InvalidInput)], data:["contract pre-release number does not match host", 51, 53]

@sreuland sreuland requested a review from Shaptic August 12, 2023 00:43
@tsachiherman
Copy link
Contributor

@sreuland are you still working on this pr ?

@sreuland
Copy link
Contributor Author

@sreuland are you still working on this pr ?

yes, this isn't ready to merge yet as it's building system-test with a reference to soroban-examples/e2e_version_bump to build contracts with the version of soroban-sdk used to match that of latest core to fix the earlier reported pre-release version number does not match error. Ideally need to get a tag or next release version of soroban-examples to use as reference instead?

beyond that, tests are not passing currently, when running cli and rpc server built from soroban-tools/main, seeing what looks like a regression in soroban contract install:

$ soroban contract install --wasm ./target/wasm32-unknown-unknown/release/soroban_hello_world_contract.wasm --rpc-url http://localhost:8000/soroban/rpc --source SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L --network-passphrase "Standalone Network ; February 2017"
error: jsonrpc error: Parse error: missing field `events` at line 1 column 371

@sreuland sreuland marked this pull request as ready for review August 21, 2023 18:50
@willemneal
Copy link
Member

@sreuland I just pushed some fixes. I used https:/stellar/soroban-tools/blob/main/cmd/soroban-rpc/internal/methods/simulate_transaction.go#L21 as a reference and turns out that all but latestLedger can be omitted. Also noticed that the Cost type had fields as strings but the go was u64 so I fixed that too.

@tsachiherman @paulbellamy @2opremio

One question about the omittable fields. Does it make sense for them to be the defaults for those types? Or should we make all of the types Options to reflect the fact that the field was not provided?

@sreuland
Copy link
Contributor Author

making progress, @willemneal fixed the json errors in cli on simulation response, the tests are now progressing to contract deploy and getting a host error:

running command soroban [contract deploy --wasm-hash 3b77a5ba1be753fcb48c9ac4bcdaaf6fef5c86084b451f28c073d42cac24a6da --rpc-url http://localhost:8000/soroban/rpc --source SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L --network-passphrase Standalone Network ; February 2017] 

error: transaction simulation failed: cannot set authorization entries

Caused by:
    HostError: Error(Auth, InvalidInput)
    DebugInfo not available

looks like the cli may have included auth entries as part of contract deploy in the simulation request to rpc preflight , but the rpc side isn't able to pass that to host? @2opremio , is this something we need to wait until latest build of core and soroban-env/sdk on?

@2opremio
Copy link
Contributor

2opremio commented Aug 28, 2023

My guess is that the format is wrong for some reason. This is where it fails:

    let needs_auth_recording = invoke_hf_op.auth.is_empty();
    if needs_auth_recording {
        host.switch_to_recording_auth(true)
            .context("cannot switch auth to recording mode")?;
    } else {
        host.set_authorization_entries(invoke_hf_op.auth.to_vec())
            .context("cannot set authorization entries")?;
    }

@willemneal / @paulbellamy can you take a look?

@2opremio
Copy link
Contributor

Happy to see the error contexts being helpful :) , the rs-env error not so much unfortunately. @sisuresh any idea of what can be the problem?

@sisuresh
Copy link
Contributor

making progress, @willemneal fixed the json errors in cli on simulation response, the tests are now progressing to contract deploy and getting a host error:

running command soroban [contract deploy --wasm-hash 3b77a5ba1be753fcb48c9ac4bcdaaf6fef5c86084b451f28c073d42cac24a6da --rpc-url http://localhost:8000/soroban/rpc --source SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L --network-passphrase Standalone Network ; February 2017] 

error: transaction simulation failed: cannot set authorization entries

Caused by:
    HostError: Error(Auth, InvalidInput)
    DebugInfo not available

looks like the cli may have included auth entries as part of contract deploy in the simulation request to rpc preflight , but the rpc side isn't able to pass that to host? @2opremio , is this something we need to wait until latest build of core and soroban-env/sdk on?

Are diagnostic events enabled? That error should have a message tied to it (I'm guessing it's one of these two errors).

@sreuland
Copy link
Contributor Author

sreuland commented Aug 28, 2023

Are diagnostic events enabled? That error should have a message tied to it (I'm guessing it's one of these two errors).

during the test case, RPC server ingestion is configured with captive core having ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=true, I'm not sure if this preflight interacts with that ingestion or does preflight get events directly back from the host interface call(s)?

those errors you referenced, they are related to ledger entry or signature type expirations? This is occurring during a test on a new standalone network where the contract is installed successfully and then within a couple seconds afterwards, cli is trying to deploy the prior installed contract and [getting that preflight error about 'cannot set authorization entries'], (https:/stellar/soroban-tools/actions/runs/6005737037/job/16289022356?pr=855#step:8:1280), so, it would seem like expiration hasn't had time yet.

Where does host.max_expiration_ledger get configured in this type of preflight, maybe that could be tripping it?

@2opremio
Copy link
Contributor

2opremio commented Aug 28, 2023

That error should have a message tied to it

@sisuresh Uhm, maybe we are not printing the errors properly? How are they supposed to be printed?

This is how we do it (we use debug printing) https:/stellar/soroban-tools/blob/main/cmd/soroban-rpc/lib/preflight/src/lib.rs#L237

I'm not sure if this preflight interacts with that ingestion or does preflight get events directly back from the host interface call(s)?

Ever since #878 , the simulateTransaction endpoint returns the diagnostic events on error, I am not sure if the CLI prints them (@willemneal , otherwise we should)

@sisuresh
Copy link
Contributor

sisuresh commented Aug 28, 2023

Here's an example of an error diagnostic event in pretty-printed xdr

 { inSuccessfulContractCall = FALSE,
    event = {
      ext = {
        v = 0
      },
      contractID = df06d62447fd25da07c0135eed7557e5a5497ee7d15b7fe345bd47e191d8f577,
      type = DIAGNOSTIC,
      body = {
        v = 0,
        v0 = {
          topics = [
            { type = SCV_SYMBOL,
              sym = "error" },
            { type = SCV_ERROR,
              error = {
                type = SCE_CONTRACT,
                contractCode = 12345
              } }
          ],
          data = {
            type = SCV_STRING,
            str = "escalating Ok(Error) frame-exit to Err(Error)"
          }
        }
      }
    } },

@sisuresh
Copy link
Contributor

In core we use https:/stellar/stellar-core/blob/a4d623048d166885b6891a003574ea0b08d64e17/src/rust/src/contract.rs#L194 which prints as

Diagnostic event: DiagnosticEvent { in_successful_contract_call: false, event: ContractEvent { ext: V0, contract_id: Some(Hash(df06d62447fd25da07c0135eed7557e5a5497ee7d15b7fe345bd47e191d8f577)), type_: Diagnostic, body: V0(ContractEventV0 { topics: VecM([Symbol(ScSymbol(StringM(error))), Error(Contract(12345))]), data: String(ScString(StringM(escalating Ok(Error) frame-exit to Err(Error)))) }) } }

@2opremio
Copy link
Contributor

2opremio commented Aug 29, 2023

In core we use https:/stellar/stellar-core/blob/a4d623048d166885b6891a003574ea0b08d64e17/src/rust/src/contract.rs#L194 which prints as

Diagnostic event: DiagnosticEvent { in_successful_contract_call: false, event: ContractEvent { ext: V0, contract_id: Some(Hash(df06d62447fd25da07c0135eed7557e5a5497ee7d15b7fe345bd47e191d8f577)), type_: Diagnostic, body: V0(ContractEventV0 { topics: VecM([Symbol(ScSymbol(StringM(error))), Error(Contract(12345))]), data: String(ScString(StringM(escalating Ok(Error) frame-exit to Err(Error)))) }) } }

I was referring to the printout of the error you were referring to at #855 (comment) which is a Host error, right?

I am surprised that debug printouts don't include the error text (e.g. "signature expiration is too late")

@2opremio
Copy link
Contributor

2opremio commented Aug 29, 2023

Ahh, after reading the code it seems like the message is only propagated to the diagnostic events. So, yeah, we should make sure we print them on error (@willemneal in simulate_transsaction() we should include them in the error at https:/stellar/soroban-tools/blob/main/cmd/soroban-cli/src/rpc/mod.rs#L595 )

Thanks @sisuresh

@willemneal
Copy link
Member

@2opremio Here is the PR that fixes the logging issues: #906

I had targeted the wrong fork and forgot about it.

@sreuland
Copy link
Contributor Author

sreuland commented Sep 1, 2023

@willemneal , with #906 merged into main, was expecting to see more verbose error output from cli when contract deploy has a simulation error response, but it doesn't look like any further diagnostic content is displaying on console:

running command soroban [contract deploy --wasm-hash 9e91a6c6234cf7a43fde49739fec8f2c2f40b9fdb068650e7a590e3791731bc7 --rpc-url http://localhost:8000/soroban/rpc --source SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L --network-passphrase Standalone Network ; February 2017] 

error: transaction simulation failed: cannot set authorization entries

Caused by:
    HostError: Error(Auth, InternalError)
    DebugInfo not available

Should diagnostic events from the sim error be shown now?

https:/stellar/soroban-tools/actions/runs/6052719647/job/16426740644?pr=855#step:8:1329

@2opremio 2opremio merged commit 060d9bf into stellar:main Sep 4, 2023
18 of 19 checks passed
@2opremio
Copy link
Contributor

2opremio commented Sep 4, 2023

@sreuland I took the liberty to merge this PR since it contained fixes we need in main (namely, making the CLI compatible with the missing simulateTransaction response fields). Sorry if I overstepped.

Please create a new PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants