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

Basic implementation of World State. #40

Merged
merged 15 commits into from
Feb 7, 2018
Merged

Basic implementation of World State. #40

merged 15 commits into from
Feb 7, 2018

Conversation

EanCuznaivy
Copy link
Contributor

And slightly modify the structure about Block.

@EanCuznaivy EanCuznaivy requested a review from loning February 2, 2018 06:51
@JackAngeles
Copy link

JackAngeles commented Feb 2, 2018 via email

@loning
Copy link
Contributor

loning commented Feb 2, 2018

@EanCuznaivy Hi, I have changed dev and merge my codes, can you merge some code from dev?

@loning
Copy link
Contributor

loning commented Feb 3, 2018

@EanCuznaivy

@EanCuznaivy
Copy link
Contributor Author

@loning Let me see...

# Conflicts:
#	AElf.Kernel/Chain.cs
#	AElf.Kernel/ChainManager.cs
#	AElf.Kernel/IAccountDataProvider.cs
#	AElf.Kernel/IDataProvider.cs
#	AElf.Kernel/ISmartContract.cs
#	AElf.Kernel/KernelAccount/SmartContractZero.cs
#	AElf.Kernel/Merkle/BinaryMerkleNode.cs
@EanCuznaivy
Copy link
Contributor Author

@loning Finally fixed the conflicts :)

{
public static class SerializationExtensions
{
public static byte[] Serialize(this object obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

ISerializable a;

ojbect b= (object)a;

ISeralizable c = (ISeralizable) b;

var bytes= c.GetBytes();

var d=bytes.ToObject(); //Deseralize


namespace AElf.Kernel
{
[Serializable]
public class Hash<T> : IHash<T>
public class Hash<T> : IHash<T>, IComparer<Hash<T>>
Copy link
Contributor

Choose a reason for hiding this comment

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

interface IHash: IComparer<Hash>{
}

@@ -24,5 +23,15 @@ public Hash():this(new byte[32])
public byte[] GetHashBytes() => Value;

public bool Equals(IHash other) => Value == other.GetHashBytes();
Copy link
Contributor

Choose a reason for hiding this comment

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

Need compare every bytes, not just compare the reference


public int Compare(Hash<T> x, Hash<T> y)
{
if (x.ToString() == y.ToString())
Copy link
Contributor

Choose a reason for hiding this comment

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

not use ToString();

@@ -6,7 +6,7 @@ namespace AElf.Kernel
/// <summary>
/// Data is stored associated with Account
/// </summary>
public interface IAccountDataProvider
public interface IAccountDataProvider : ISerializable
Copy link
Contributor

Choose a reason for hiding this comment

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

Data Provider is a Driver, should not be ISerializable, it's just a tool for data access

@samsoull
Copy link

samsoull commented Feb 5, 2018

💸💴💵💰

@JackAngeles
Copy link

JackAngeles commented Feb 6, 2018 via email

@EanCuznaivy EanCuznaivy merged commit b9410d0 into AElfProject:dev Feb 7, 2018
@pengailbitco
Copy link

Thank you for subscribing me

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.

5 participants