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

DeployContract implementation for Tezos connector #1481

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

alex-semenyuk
Copy link
Member

@alex-semenyuk alex-semenyuk commented Mar 20, 2024

Related PRs to firefly-tezosconnect and firefly-cli

Request example

{
   "key":"tz1V3spuktTP2wuEZP7D2hJruLZ5uJTuJk31",
   "contract":{
      "code":[
         {
            "args":[
               {
                  "prim":"string"
               }
            ],
            "prim":"parameter"
         },
         {
            "args":[
               {
                  "prim":"string"
               }
            ],
            "prim":"storage"
         },
         {
            "args":[
               [
                  {
                     "prim":"CAR"
                  },
                  {
                     "args":[
                        {
                           "prim":"operation"
                        }
                     ],
                     "prim":"NIL"
                  },
                  {
                     "prim":"PAIR"
                  }
               ]
            ],
            "prim":"code"
         }
      ],
      "storage":{
         "string":"hello world"
      }
   }
}

Response

{
  "id": "3caf86b2-be4d-40c2-9450-bd4af5340e4a",
  "namespace": "default",
  "tx": "b492cd22-2eff-4b78-a9f2-95da5db58e9b",
  "type": "blockchain_deploy",
  "status": "Pending",
  "plugin": "tezos",
  "input": {
    "contract": {
      "code": [
        {
          "args": [
            {
              "prim": "string"
            }
          ],
          "prim": "parameter"
        },
        {
          "args": [
            {
              "prim": "string"
            }
          ],
          "prim": "storage"
        },
        {
          "args": [
            [
              {
                "prim": "CAR"
              },
              {
                "args": [
                  {
                    "prim": "operation"
                  }
                ],
                "prim": "NIL"
              },
              {
                "prim": "PAIR"
              }
            ]
          ],
          "prim": "code"
        }
      ],
      "storage": {
        "string": "hello world!!!!"
      }
    },
    "definition": null,
    "input": null,
    "key": "tz1V3spuktTP2wuEZP7D2hJruLZ5uJTuJk31",
    "options": null
  },
  "created": "2024-03-19T21:06:22.871702Z",
  "updated": "2024-03-19T21:06:22.871702Z"
}

Signed-off-by: Alexey Semenyuk <[email protected]>
@alex-semenyuk alex-semenyuk requested a review from a team as a code owner March 20, 2024 08:17
@codecov-commenter
Copy link

codecov-commenter commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.99%. Comparing base (577e8c4) to head (f4be7bf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1481   +/-   ##
=======================================
  Coverage   99.99%   99.99%           
=======================================
  Files         322      322           
  Lines       23406    23424   +18     
=======================================
+ Hits        23404    23422   +18     
  Misses          1        1           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

t.metrics.BlockchainContractDeployment()
}
headers := TezosconnectMessageHeaders{
Type: "DeployContract",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to have as constant, as these types are used by several chains

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done

}
body, err = t.applyOptions(ctx, body, options)
if err != nil {
return true, err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarification, let's use resErr.SubmissionRejected instead as we did it below

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resErr.SubmissionRejected is a bool value, applyOptions returns error

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, instead of 'true' value

Signed-off-by: Alexey Semenyuk <[email protected]>
@alex-semenyuk alex-semenyuk force-pushed the tezos_deploy_contract branch from 2d58ba6 to f4be7bf Compare March 21, 2024 16:46
@@ -745,9 +745,7 @@ func (e *Ethereum) DeployContract(ctx context.Context, nsOpID, signingKey string
"definition": definition,
"contract": contract,
}
if signingKey != "" {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check doesn't make sense since at line 743 we already set "from" to signingKey

}
body, err = t.applyOptions(ctx, body, options)
if err != nil {
return true, err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, instead of 'true' value

@nguyer nguyer merged commit d460998 into hyperledger:main Apr 8, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants