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

Policy sync issue in batch command #281

Closed
EdgeDLT opened this issue Jun 14, 2023 · 7 comments
Closed

Policy sync issue in batch command #281

EdgeDLT opened this issue Jun 14, 2023 · 7 comments

Comments

@EdgeDLT
Copy link
Contributor

EdgeDLT commented Jun 14, 2023

I've been testing the neo-devpack-ts and tried to enhance the NEP17 sample's batch file with a policy sync step, in order to do some basic GAS consumption comparisons with MainNet values. Adding this line to the start of the express.batch file and running neoxp batch express.batch results in the error McMaster.Extensions.CommandLineUtils.UnrecognizedCommandParsingException: Unrecognized command or argument 'sync'.

While troubleshooting, I noticed some other oddities. For example, in this sample repo, policy get gives System.Exception: Cannot call this method with the flag ReadOnly. If I move to a fresh directory and neoxp create, using policy get gives the expected result. I'd chalk it up to an Express version difference (v3.5.20), but in the new instance I have the same issue with batch.

My process:

neoxp policy get -r mainnet --json > policy.json
neoxp policy sync policy.json genesis
neoxp policy get

I get the expected result:

GasPerBlock: 500000000 (5 GAS)
MinimumDeploymentFee: 1000000000 (10 GAS)
CandidateRegistrationFee: 100000000000 (1000 GAS)
OracleRequestFee: 10000000 (0.1 GAS)
NetworkFeePerByte: 100 (0.000001 GAS)
StorageFeeFactor: 100
ExecutionFeeFactor: 3

Repeating these steps but replacing the sync step with batch batch.express, with the batch file containing only policy sync policy.json genesis, I receive the original error noted above.

It's not a blocker for me because I can do everything I want with manual policy set steps, but it would be nice to have sync work in batches for convenience.

@devhawk
Copy link
Contributor

devhawk commented Jun 14, 2023

This is by design. From https://github.com/neo-project/neo-express/blob/master/docs/command-reference.md#neoxp-policy-sync

Note: when using policy sync in a batch command file, the policy settings must be retrieved from a local JSON
file. Reading policy settings from a remote Neo network during a batch operation is not supported.

@devhawk devhawk closed this as completed Jun 14, 2023
@devhawk
Copy link
Contributor

devhawk commented Jun 14, 2023

Batch is designed to get your environment to a known state. Since the policy data on a public net can change, it's not allowed during batch.

You can download the current policy to a file with neoxp policy get --json > policy.json and then sync to the policy.json file

@devhawk
Copy link
Contributor

devhawk commented Jun 14, 2023

my bad, didn't read the issue closely

@devhawk devhawk reopened this Jun 14, 2023
@devhawk devhawk self-assigned this Jun 14, 2023
devhawk pushed a commit that referenced this issue Jun 14, 2023
@devhawk devhawk removed their assignment Jul 31, 2023
@cschuchardt88
Copy link
Member

This can be closed.

@lock9
Copy link
Contributor

lock9 commented Nov 15, 2023

Did you test it @cschuchardt88 ?

@cschuchardt88
Copy link
Member

cschuchardt88 commented Nov 15, 2023

see #335

@cschuchardt88
Copy link
Member

cschuchardt88 commented Nov 18, 2023

@Liaojinghui Close this its fixed now, I forgot to link it.

@Jim8y Jim8y closed this as completed Nov 18, 2023
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 a pull request may close this issue.

5 participants