Skip to content

Scoped signatures#928

Closed
shargon wants to merge 22 commits intoneo-project:masterfrom
shargon:scoped-signatures
Closed

Scoped signatures#928
shargon wants to merge 22 commits intoneo-project:masterfrom
shargon:scoped-signatures

Conversation

@shargon
Copy link
Copy Markdown
Member

@shargon shargon commented Jul 17, 2019

Close #544

I have a problem with makeTransaction, because i need the witness ...

shargon added 3 commits July 17, 2019 12:59
* Change view reason

* Move order for compatibility

* Moved to other file

* Change order

* Change agreement
}

public int Size => InvocationScript.GetVarSize() + VerificationScript.GetVarSize();
public bool HasScopedHash => Scope == WitnessScope.CustomScriptHash || Scope == WitnessScope.ExecutingGroupPubKey;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is very well done Shargon, congratulations. We just need to filter this pubkey here, as it has another size other than Hash160.... I'm not against groupHash concept Hash160(pubkey) or Hash160(21+pubkey+ac concept...), and group becomes a witness 😂 or just keep pubkey, and count bytes correctly ;)

{
if (CommitPayloads[i]?.ConsensusMessage.ViewNumber != ViewNumber) continue;
sc.AddSignature(contract, Validators[i], CommitPayloads[i].GetDeserializedMessage<Commit>().Signature);
sc.AddSignature(contract, Validators[i], CommitPayloads[i].GetDeserializedMessage<Commit>().Signature, WitnessScope.Global, UInt160.Zero);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we keep Global as default param? Same for filter zero?

((IVerifiable)this).DeserializeUnsigned(reader);
if (reader.ReadByte() != 1) throw new FormatException();
Witness = reader.ReadSerializable<Witness>();
if (Witness.Scope != WitnessScope.Global) throw new FormatException();
Copy link
Copy Markdown
Contributor

@igormcoelho igormcoelho Jul 18, 2019

Choose a reason for hiding this comment

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

Very good move. Blocks/Consensus require global witness.

/// <summary>
/// EntryScriptHash - no params (root-only witnesses) - can be default safe choice for native NEO/GAS (neo2 attach mode)
/// </summary>
InitScriptHash = 0x01,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should ensure that EntryScriptHash == CallingScriptHash, during CheckWitness verification.

Copy link
Copy Markdown
Contributor

@igormcoelho igormcoelho left a comment

Choose a reason for hiding this comment

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

In a very good direction, congratulation Shargon!

shargon and others added 16 commits July 18, 2019 09:15
* Remove minner tx hole

* Fix equals
* Seconds to milliseconds

* Sending unsaved files

* fixing formula of consensus bonification

* Refactoring milliseconds

* Refactoring milliseconds from capeslock

* Refactoring milliseconds from capeslock II

* Adjusting UT

* Adjusting UT II

* Super fast protocol to 2s

* Fixing timestamps to long and tests

* Minor adjusts

* Change view deserialization fix

* Timestamp to ulong

* Update neo/Helper.cs

Co-Authored-By: Shargon <shargon@gmail.com>

* Update JNumber.cs

* Optimize and remove TODO

* Update ApplicationEngine.cs

* Fixing ExtendTimerByFactor 

This was already from milliseconds, thus, just removing the multiplier
* allow CheckWitness to work when using invokescript

* Fix

* Update RpcServer.cs

* Allow more than one signature

* Reorder properties
)

* testDemo

* add dll lib

* add dbsnapshot dispose

* test get blocks in levelDBStore

* add levelDBStore test funcs

* fix levelDBStore funcs

* add DbCache addInternal

* differ db path

* space

* fix delete internal test

* add test getInternal tryGetInternal move libleveldb.dll

* add dbCache method test

* add store test

* add cache unit tests

* add cache unit tests

* up readonly max_capacity

* fix leveldbexception

* fix comment on UT_Cache

* format

* fix multithread test problem

* up cache

* update travis config

* update travis.yml

* test DbMetaDataCache

* fix db directory

* format and update travis for maxos

* fix mac env travis

* 2019/7/12 10:34

* 2019/7/12 11:01

* remove commented line

* test BigDecimal

* fix format and csproj

* rm  coverage.opencover.xml

* update method name

* add UT_P_Helper

* modify UT_P_Helper

* modify UT_P_helper

* Clean ut

* test Base58 & BloomFilter

* Update UT_Cache.cs

* Correct Typo

* test JsonArray

* update namespace

* update namespace

* update format

* update format

* organise folder structure

* add UT_JString

* test JBoolean JNumber & JObject

* 2019/7/16 10:30

add some test case for UInt32Wrapper and SerializableWrapper

* fix timestamp

* test ECDsa and Crypto

* test OrderedDictionary & complete IO.Json tests

* 2019/7/16 17:33

add some test case of SQLiteWallet

* test FIFOSet

* add CloneCache and DataCache unit tests

* fix namespace

* add UT_Cryptography_Helper

* format UT_CloneCache and UT_DataCache

* add UT_DataCache.GetAndChange unit test

* update namespace

* remove comment code

* delete Persistence part

* 2019/7/19 11:07

add some test case for Helper in VM

* Fix Base58 Test

* 2019/7/19 11:33

change some format

* update IOHelper exception assert

* 2019/7/19 14:22

change format

* format IOHelper

* review IO.Wrapper

* review Wallets.SQLite UT

* Test ECFieldElement ECPoint

* refactor package

* format ECDsa

* update namespace

* Code fix

* review cache

* modify UT_JString

* fomat

* using Actin replace with try-catch

* add UT_CloneMetaCache and UT_MetaDataCache

* update namespace

* format UT_DataCache.cs

* Code Fix

* format

* update csproj

* Code fix for UT_ECFieldElement and UT_ECPoint

* Code fix

* format

* update travis

* delete deleteFiles

* fix path and comment

* update travis

* delete test ToTimeStamp

* format UT_*Cache

* update format

* fomat

* use hex extensions in Cryptography_Helper

* remove reflection

* optimization of UT_DataCache

* update namespace

* modify TestSha256
* Script header

* Script header draft

* Clean files

* Typo

* Rename class and magic header

* Clean hash

* UT

* Erik's suggestions

* Change name

* Typo

* Check magic

* 64 to 32

* Nef file only for neo-cli

* Real Checksum

* Clean

* Clean again

* Remove code

* Update neo/SmartContract/NefFile.cs

Co-Authored-By: Igor Machado Coelho <igor.machado@gmail.com>

* Enum to const

* Remove unnecessary change

* Apply Erik's suggestions
* testDemo

* add dll lib

* add dbsnapshot dispose

* test get blocks in levelDBStore

* add levelDBStore test funcs

* fix levelDBStore funcs

* add DbCache addInternal

* differ db path

* space

* fix delete internal test

* add test getInternal tryGetInternal move libleveldb.dll

* add dbCache method test

* add store test

* add cache unit tests

* add cache unit tests

* up readonly max_capacity

* fix leveldbexception

* fix comment on UT_Cache

* format

* fix multithread test problem

* up cache

* update travis config

* update travis.yml

* test DbMetaDataCache

* fix db directory

* format and update travis for maxos

* fix mac env travis

* 2019/7/12 10:34

* 2019/7/12 11:01

* remove commented line

* test BigDecimal

* fix format and csproj

* rm  coverage.opencover.xml

* update method name

* add UT_P_Helper

* modify UT_P_Helper

* modify UT_P_helper

* Clean ut

* test Base58 & BloomFilter

* Update UT_Cache.cs

* Correct Typo

* test JsonArray

* update namespace

* update namespace

* update format

* update format

* organise folder structure

* add UT_JString

* test JBoolean JNumber & JObject

* 2019/7/16 10:30

add some test case for UInt32Wrapper and SerializableWrapper

* fix timestamp

* test ECDsa and Crypto

* test OrderedDictionary & complete IO.Json tests

* 2019/7/16 17:33

add some test case of SQLiteWallet

* test FIFOSet

* add CloneCache and DataCache unit tests

* fix namespace

* add UT_Cryptography_Helper

* format UT_CloneCache and UT_DataCache

* add UT_DataCache.GetAndChange unit test

* update namespace

* remove comment code

* delete Persistence part

* 2019/7/19 11:07

add some test case for Helper in VM

* Fix Base58 Test

* 2019/7/19 11:33

change some format

* update IOHelper exception assert

* 2019/7/19 14:22

change format

* format IOHelper

* review IO.Wrapper

* review Wallets.SQLite UT

* Test ECFieldElement ECPoint

* refactor package

* format ECDsa

* update namespace

* Code fix

* review cache

* modify UT_JString

* fomat

* using Actin replace with try-catch

* add UT_CloneMetaCache and UT_MetaDataCache

* update namespace

* format UT_DataCache.cs

* Code Fix

* format

* update csproj

* Code fix for UT_ECFieldElement and UT_ECPoint

* Code fix

* format

* update travis

* delete deleteFiles

* fix path and comment

* update travis

* delete test ToTimeStamp

* format UT_*Cache

* update format

* fomat

* use hex extensions in Cryptography_Helper

* remove reflection

* optimization of UT_DataCache

* update namespace

* modify TestSha256

* update UT in crypto module

* Rename UT_Scrypt.cs to UT_SCrypt.cs

* format

* update UT_Murmur3
@igormcoelho
Copy link
Copy Markdown
Contributor

@shargon I may need to change quite a few things here, is that ok?

* Add NEO SDK based on RPC client

* add rpc interface methods for neo3

* update unit test

* add unit test

* Update TransactionHelper.cs

Changed for neo 3.0, not final yet.

* implement sdk rpc client methods

* backup files

* change class name

* remove uncompleted modules for pull request

* change json deserialize method with Neo JObject

* modified JSON implementation, added FromJson()

* more RPC change

* PR correction

* RPC module fix, remove newton.json

* fix

* fix getblock issue

* PR correction

* PR Correction

* PR Correction: rename RPC models

* PR Correction

* resolve conflicts

* Clean code

* Clean code

* Clean code

* Clean code

* Update RpcValidateAddressResult.cs

* Clean code

* PR correction

* Move test file to the right place
@vncoelho
Copy link
Copy Markdown
Member

Maybe it is better to open a new one I think, Igor.

@shargon shargon marked this pull request as ready for review July 30, 2019 16:21
@shargon
Copy link
Copy Markdown
Member Author

shargon commented Jul 30, 2019

@igormcoelho feel free to modify, i think that is better to improve this one, for finish it quicker

@shargon
Copy link
Copy Markdown
Member Author

shargon commented Jul 30, 2019

I will close it, and create a new one cleaner

@shargon shargon closed this Jul 30, 2019
@shargon shargon deleted the scoped-signatures branch July 30, 2019 16:29
@igormcoelho
Copy link
Copy Markdown
Contributor

Shargon, I'll try to start another one in a very different direction... this way we increase the odds of finishing this quickly.

@shargon
Copy link
Copy Markdown
Member Author

shargon commented Jul 30, 2019

Is duplicate work

@igormcoelho
Copy link
Copy Markdown
Contributor

igormcoelho commented Jul 30, 2019

Is duplicate work

Why? Don't you think we should try a different approach? As long as problem is solved, I don't see a problem with it. In fact, it could be a solution...

@igormcoelho
Copy link
Copy Markdown
Contributor

igormcoelho commented Jul 30, 2019

@shargon I opened another PR, but please cleanup and re-open yours. This way, we can have complementary views that may solve the problem. Or if you prefer, re-open yours and take parts of mine that help solving the issue (if any). It's time to have this solved, a very critical feature.

Thacryba pushed a commit to simplitech/neo that referenced this pull request Feb 17, 2020
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.

Scoped Witnesses

7 participants