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

Relocate transaction verification #1507

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
1d0ef09
Merge pull request #13 from neo-project/master
Qiao-Jin Mar 19, 2020
b14a589
Relocate transaction verifcation
Mar 20, 2020
e81cc6b
Merge pull request #17 from neo-project/master
Qiao-Jin Mar 23, 2020
915794e
Merge pull request #23 from neo-project/master
Qiao-Jin Mar 24, 2020
58b6731
Merge pull request #29 from neo-project/master
Qiao-Jin Mar 24, 2020
df5a99f
Merge branch 'master' of https://github.com/neo-project/neo into neo-…
Mar 25, 2020
28e3f48
Merge branch 'neo-project-master' into relocate_transaction_verification
Mar 25, 2020
9f2f7c6
Code optimization
Mar 25, 2020
241a92d
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Mar 27, 2020
ab4bb26
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Mar 27, 2020
fcaf7e4
Seperate sender fee check from transaction verification
Mar 30, 2020
2cfa56b
Merge branch 'relocate_transaction_verification' of https://github.co…
Mar 30, 2020
f7ba395
Format modification
Mar 30, 2020
eedb714
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Mar 31, 2020
b9f3a46
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Apr 2, 2020
3828ab2
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Apr 3, 2020
e407aad
Function rename and add parallel strategy
Apr 3, 2020
382605e
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Apr 3, 2020
6896500
Code optimization
Apr 6, 2020
b3b8c25
Code optimization
Apr 7, 2020
27ef0af
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Apr 8, 2020
0173cd3
Code optimization
Apr 8, 2020
78b304f
Format optimization
Apr 8, 2020
eb6f41f
Code optimization
Apr 8, 2020
35d7995
Merge branch 'master' of https://github.com/neo-project/neo into neo-…
Apr 10, 2020
08fa2a2
Merge branch 'neo-project-master' into relocate_transaction_verification
Apr 10, 2020
e65623a
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Apr 13, 2020
1e63267
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Apr 20, 2020
a0dcaf0
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Apr 26, 2020
7b605af
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Apr 27, 2020
4dad4d0
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin May 6, 2020
729d2ce
Fix VerifyWitnesses
May 6, 2020
fcc3c12
Revert "Fix VerifyWitnesses"
May 6, 2020
e578754
Rewrite verify_witness and corresponding logic
May 7, 2020
d228a51
code format
May 7, 2020
c08dc91
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin May 7, 2020
51e785c
Add statedependent to witness
May 9, 2020
a494053
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin May 9, 2020
83ee355
Code optimization
May 9, 2020
5c10326
Update src/neo/Network/P2P/Payloads/Witness.cs
Qiao-Jin May 9, 2020
f78503e
Update src/neo/Network/P2P/Payloads/Witness.cs
Qiao-Jin May 9, 2020
64d2a3f
Update src/neo/Network/P2P/Payloads/Witness.cs
Qiao-Jin May 9, 2020
5bea75d
Revert "Update src/neo/Network/P2P/Payloads/Witness.cs"
May 9, 2020
a4b38f0
Revert "Update src/neo/Network/P2P/Payloads/Witness.cs"
May 9, 2020
f119e18
Revert "Update src/neo/Network/P2P/Payloads/Witness.cs"
May 9, 2020
47567ae
optimize Witness
May 9, 2020
e0a5752
optimize witness and IVerifiable.verifyWitness
May 9, 2020
406e1d0
fix tx.Verify
May 9, 2020
116b59a
optimize code
May 9, 2020
fb9853a
optimize tx.GetScriptHashesForVerifying
May 9, 2020
b8c139e
Remove verifyForEachBlock
May 9, 2020
33a70fc
add VerifyResult.InvalidWitness
May 9, 2020
e263a06
Disallow witness.verificationScript to access the snapshot
May 9, 2020
2016da9
Optimize tx.VerifyStateDependent and verifiable.VerifyWitness
May 9, 2020
0bd4479
format
May 9, 2020
8666976
fix VerifyWitness
May 10, 2020
4f832ba
optimize tx.verify
May 10, 2020
5d1a218
optimize verifywitness
May 10, 2020
de81ddd
reset InteropService
May 11, 2020
0638e0b
add UT
May 11, 2020
4d1e1ac
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin May 12, 2020
9696c6a
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin May 15, 2020
c32f0fa
Split func OnInventoryReceived to avoid dirty write
May 15, 2020
be04b26
Merge branch 'master' into relocate_transaction_verification
shargon May 15, 2020
f9f2661
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin May 18, 2020
80ffb08
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin May 19, 2020
c198d6a
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin May 26, 2020
f3a5390
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin May 27, 2020
7ab56c3
Renew UT
May 27, 2020
235c9b9
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Jun 3, 2020
689d269
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Jul 10, 2020
a06c26a
Merge branch 'local_master' into relocate_transaction_verification
Aug 7, 2020
9d81c55
Check transaction size before creating task
Aug 7, 2020
13df078
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Aug 7, 2020
151dbac
Add missing note
Aug 7, 2020
1e76ed3
Merge branch 'relocate_transaction_verification' of https://github.co…
Aug 7, 2020
0ab3d71
Fix gas
shargon Aug 7, 2020
c8be765
Re-fix
shargon Aug 7, 2020
8f9bd7e
Merge branch 'master' into relocate_transaction_verification
shargon Aug 7, 2020
868ff31
Redefine WitnessFlag
Aug 7, 2020
a77ea11
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Aug 10, 2020
5288f27
Change multi task to actor pool
Aug 12, 2020
8c6ce68
Format correction
Aug 12, 2020
1320c78
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Aug 12, 2020
16fb3de
Update Transaction.cs
erikzhang Aug 13, 2020
d9c80ec
Rename
erikzhang Aug 13, 2020
90027d9
Update Witness.cs
erikzhang Aug 13, 2020
06e5d19
Merge branch 'master' into relocate_transaction_verification
Qiao-Jin Aug 13, 2020
f3b691a
Public transaction router
Aug 13, 2020
e6880d6
Fix and optimize
erikzhang Aug 14, 2020
c944e86
Move namespace
erikzhang Aug 14, 2020
cd0cd41
Move namespace
erikzhang Aug 14, 2020
3811cf6
Optimize
erikzhang Aug 14, 2020
f079a0f
Use the correct CallFlags
erikzhang Aug 14, 2020
55e3597
Merge branch 'master' into relocate_transaction_verification
erikzhang Aug 14, 2020
ea94018
Merge branch 'master' into relocate_transaction_verification
shargon Aug 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/neo/Ledger/Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class FillCompleted { }
private readonly Dictionary<UInt256, Block> block_cache = new Dictionary<UInt256, Block>();
private readonly Dictionary<uint, LinkedList<Block>> block_cache_unverified = new Dictionary<uint, LinkedList<Block>>();
internal readonly RelayCache ConsensusRelayCache = new RelayCache(100);
private SnapshotView currentSnapshot;
public SnapshotView currentSnapshot;
erikzhang marked this conversation as resolved.
Show resolved Hide resolved

public IStore Store { get; }
public ReadOnlyView View { get; }
Expand Down Expand Up @@ -400,14 +400,11 @@ private void OnNewHeaders(Header[] headers)

private void OnNewTransaction(Transaction transaction, bool relay)
{
RelayResultReason reason;
RelayResultReason reason = RelayResultReason.Succeed;
if (ContainsTransaction(transaction.Hash))
reason = RelayResultReason.AlreadyExists;
else if (!MemPool.CanTransactionFitInPool(transaction))
reason = RelayResultReason.OutOfMemory;
else
reason = transaction.Verify(currentSnapshot, MemPool.SendersFeeMonitor.GetSenderFee(transaction.Sender));

if (reason == RelayResultReason.Succeed)
{
if (!MemPool.TryAdd(transaction.Hash, transaction))
Expand Down
9 changes: 8 additions & 1 deletion src/neo/Network/P2P/ProtocolHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ private void OnMessage(Message msg)
break;
case MessageCommand.Transaction:
if (msg.Payload.Size <= Transaction.MaxTransactionSize)
OnInventoryReceived((Transaction)msg.Payload);
{
Transaction tx = (Transaction)msg.Payload;
if (tx.Verify(Blockchain.Singleton.currentSnapshot, Blockchain.Singleton.MemPool.SendersFeeMonitor.GetSenderFee(tx.Sender)) != RelayResultReason.Succeed)
{
erikzhang marked this conversation as resolved.
Show resolved Hide resolved
return;
}
OnInventoryReceived(tx);
}
break;
case MessageCommand.Verack:
case MessageCommand.Version:
Expand Down