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

Allow variable length message in ed_verify #6419

Merged
merged 61 commits into from
Aug 16, 2024

Conversation

SwayStar123
Copy link
Collaborator

@SwayStar123 SwayStar123 commented Aug 15, 2024

Description

Change ed_verify to use a Bytes for the msg instead of b256 for a msg_hash

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

vaivaswatha and others added 30 commits August 13, 2024 12:12
With the target contract broken down into chunks (with
sizes that are word aligned), we can load it in pieces
and then execute.
Bumps dependencies so that we start to use fuel-core v0.31.0.

Waiting on:

1. FuelLabs/forc-wallet#197
2. FuelLabs/forc-wallet#196

---------

Co-authored-by: Igor Rončević <ironcev@hotmail.com>
… `[proxy]` enabled (#6069)

Part of #6068.

This PR adds couple of things:

1. A default proxy contract implementation taken from [sway
standards](https://github.com/FuelLabs/sway-standards/blob/master/standards/src/src14.sw).
2. Infra for creating, building and deploying the reference
implementation for proxy contracts.
3. Deployment procedure such that proxy contract is deployed while
working on a contract which enables the `[proxy]` in its forc.toml. In a
way that it is owned by the deployer and the target initially points to
implementation contract.
4. Infra for making a contract call into the already deployed proxy
contracts to update their targets.
5. Adds a `Building` text to the all forc build invocations to better
inform the user about what forc is doing behind the scenes.
6. Removes duplicate forc-wallet password prompts which was very
frustrating for the users. Now forc-wallet deployment path only asks for
password once.
7. Refactors around how secret_key is selected based on user input
8. Updated docs around forc-client
9. Docs around how to use the proxy feature

If the user does not have a proxy table in their forc.toml, nothing
changes, same old deployment procedure is followed. Only difference is
that this PR improves the ux by removing the need of providing the
password multiple times.

If the user has a contract with a proxy table but without an address
like:

```TOML
[project]
authors = ["kaya"]
entry = "main.sw"
license = "Apache-2.0"
name = "impl-contract"

[dependencies]

[proxy]
enabled = true
```
Forc automatically creates a proxy contract based on the reference
implementation at
[SRC14](https://github.com/FuelLabs/sway-standard-implementations/tree/61fd4ad8f69d21cec0d5cd8135bdc4495e0c125c). Sets its
target to the implementation contract, whichever contract enabled the
proxy and the owner to the deployer (signing account of the
transaction).

If the user has a contract with a proxy table and an address specified
like:

```TOML
[project]
authors = ["kaya"]
entry = "main.sw"
license = "Apache-2.0"
name = "impl-contract"

[dependencies]

[proxy]
enabled = true
address = "........."
```
Forc automatically makes a set target conract call to update the proxy
contract's target. Pointing it to the newly deployed impl contract which
defines the proxy table.

Generated proxy contract abi and bins are stored at
`~/.forc/.generated_proxy_contracts/project_name` for housekeeping.
Added error ABIHashCollision error.
The flag json_abi_with_callpaths was removed because its is now supported
by the SDKs and because not using it is unsafe, as names can collide.
@SwayStar123 SwayStar123 dismissed stale reviews from alfiedotwtf and IGI-111 via 3ed7e1b August 16, 2024 07:37
@bitzoic bitzoic added lib: std Standard library breaking May cause existing user code to break. Requires a minor or major release. labels Aug 16, 2024
@SwayStar123 SwayStar123 changed the title Add variable length to ed_verify Allow variable length message in ed_verify Aug 16, 2024
bitzoic
bitzoic previously approved these changes Aug 16, 2024
@bitzoic bitzoic marked this pull request as ready for review August 16, 2024 14:29
@bitzoic bitzoic requested review from a team as code owners August 16, 2024 14:29
@bitzoic bitzoic enabled auto-merge (squash) August 16, 2024 14:29
@K1-R1 K1-R1 requested a review from a team August 16, 2024 14:51
@SwayStar123 SwayStar123 disabled auto-merge August 16, 2024 15:02
@SwayStar123 SwayStar123 enabled auto-merge (squash) August 16, 2024 15:02
@SwayStar123 SwayStar123 requested a review from IGI-111 August 16, 2024 15:05
@SwayStar123 SwayStar123 merged commit 33549ed into master Aug 16, 2024
38 checks passed
@SwayStar123 SwayStar123 deleted the swaystar123/variablelengthed_verify branch August 16, 2024 16:54
let verified_1 = ed_verify(pub_key_1, signature_1, msg_hash_1);
assert(verified_1.is_ok());
assert(verified_1.unwrap());
// use ed25519_dalek::ed25519::signature::Signer;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking: did you mean to leave this old test in a comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking May cause existing user code to break. Requires a minor or major release. lib: std Standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.