Why cannot connect to ledger Daml-on-Sawtooth via dazl python?

124 Views Asked by At

I am trying to deploy this https://github.com/digital-asset/dazl-client/tree/master/samples/ping-pong DAML smart contract with dazl client on Sawtooth. Based on daml-on sawtooth example https://github.com/blockchaintp/daml-on-sawtooth. I used this commands:

  1. cd /home/.../daml-on-sawtooth-master

export ISOLATION_ID=my-local-build

bin/build.sh

  1. cd /home/.../daml-on-sawtooth-master

daml ledger allocate-parties Alice Bob --host localhost --port 9000

  1. daml ledger upload-dar --host localhost --port 9000 /home/.../.daml/dist/pingpong-1.0.0.dar

  2. daml ledger navigator --host localhost --port 9000

Until now everything is ok. I can access navigator and daml-on-sawtooth-tracer

However, when i am trying to send transactions from dazl

  1. /home/.../samples/ping-pong/pingpong pipenv run python3 main.py --url http://localhost:9000

I receive this error: [ ERROR] 2020-03-29 20:13:13,409 | dazl | Tried to send a command and failed! Traceback (most recent call last): File "/home/usr/.local/share/virtualenvs/bot-m0tvQ3xh/lib/python3.7/site-packages/dazl/client/_party_client_impl.py", line 415, in main_writer await submit_command_async(client, p, commands) File "/home/usr anaconda3/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/usr/.local/share/virtualenvs/bot-m0tvQ3xh/lib/python3.7/site-packages/dazl/protocols/v1/grpc.py", line 42, in lambda: self.connection.command_service.SubmitAndWait(request)) File "/home/usr/.local/share/virtualenvs/bot-m0tvQ3xh/lib/python3.7/site-packages/grpc/_channel.py", line 826, in call return _end_unary_response_blocking(state, call, False, None) File "/home/usr/.local/share/virtualenvs/bot-m0tvQ3xh/lib/python3.7/site-packages/grpc/_channel.py", line 729, in _end_unary_response_blocking raise _InactiveRpcError(state) grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "Invalid argument: Command TTL (the difference between ledger effective time and maximum record time) PT30S is out of bounds. Min: PT41S. Max: PT1M20S. Client may attempt resubmission with a value that falls within that interval." debug_error_string = "{"created":"@1585501993.408836076","description":"Error received from peer ipv6:[::1]:9000","file":"src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"Invalid argument: Command TTL (the difference between ledger effective time and maximum record time) PT30S is out of bounds. Min: PT41S. Max: PT1M20S. Client may attempt resubmission with a value that falls within that interval.","grpc_status":3}"

1

There are 1 best solutions below

3
On

The important part of the error message is the very last bit.

"Invalid argument: Command TTL (the difference between ledger effective time and maximum record time) PT30S is out of bounds. Min: PT41S. Max: PT1M20S. Client may attempt resubmission with a value that falls within that interval.","grpc_status":3}"

What this is saying is that you/DAZL set maximum_record_time to ledger_effective_time + 30s, but that DAML on Sawtooth requires values between ledger_effective_time + 41s and ledger_effective_time + 120s.

Looking at the DAZL sources, it looks like the 30s are hardcoded here: https://github.com/digital-asset/dazl-client/blob/f7ba752b1ae7d007d457f43ef2f723fdc6e94fb9/python/dazl/client/_party_client_impl.py#L408

To get it to work with Sawtooth, you probably need to change that number. I've created an issue to make it configurable here: https://github.com/digital-asset/dazl-client/issues/73